#!/bin/bash
#gls
GLS=`ps -ef|grep -i Gls|grep -v grep | wc -l`
if [ $GLS -eq 0 ];then
    sleep 5  #睡眠5秒
    if [ `ps -ef|grep -i Gls|grep -v grep | wc -l` -eq 0 ];then
    service keepalived stop #启动失败，将keepalived服务杀死。将vip漂移到其它备份节点
    fi
fi

#License
L=`ps -ef|grep -i License|grep -v grep | wc -l`
if [ $L -eq 0 ];then
    sleep 5
    if [ `ps -ef|grep -i License|grep -v grep | wc -l` -eq 0 ];then
		service keepalived stop
    fi
fi

#datakeeper
D=`ps -ef|grep -i datakeeper|grep -v grep | wc -l`
if [ $D -eq 0 ];then
    sleep 5
    if [ `ps -ef|grep -i datakeeper|grep -v grep | wc -l` -eq 0 ];then
		service keepalived stop
    fi
fi